<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>订单详情 - 餐厅管理系统</title>
    <style>
        * { margin: 0; padding: 0; box-sizing: border-box; }
        body { font-family: 'Microsoft YaHei', Arial, sans-serif; background: #f5f5f5; }
        .container { max-width: 1000px; margin: 0 auto; padding: 20px; }
        .header { background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%); color: white; padding: 30px; border-radius: 10px; margin-bottom: 30px; text-align: center; }
        .card { background: white; padding: 30px; border-radius: 10px; box-shadow: 0 4px 12px rgba(0,0,0,0.1); margin-bottom: 20px; }
        .card h2 { color: #2d3748; margin-bottom: 20px; padding-bottom: 10px; border-bottom: 3px solid #4299e1; }
        .info-row { display: flex; padding: 15px 0; border-bottom: 1px solid #e2e8f0; }
        .info-row:last-child { border-bottom: none; }
        .info-label { font-weight: 600; color: #4a5568; width: 150px; }
        .info-value { color: #2d3748; flex: 1; }
        .btn { padding: 10px 20px; border: none; border-radius: 6px; cursor: pointer; text-decoration: none; display: inline-block; margin-right: 10px; }
        .btn-secondary { background: #718096; color: white; }
        .btn-secondary:hover { background: #4a5568; }
        .empty { text-align: center; padding: 40px; color: #999; font-style: italic; }
    </style>
</head>
<body>
    <div class="container">
        <div class="header">
            <h1>📋 订单详细信息</h1>
        </div>

        <div class="card">
            <h2>订单基本信息</h2>
            <div class="info-row">
                <div class="info-label">订单ID:</div>
                <div class="info-value" th:text="${order.id}"></div>
            </div>
            <div class="info-row">
                <div class="info-label">顾客ID:</div>
                <div class="info-value" th:text="${order.customerId}"></div>
            </div>
            <div class="info-row">
                <div class="info-label">订单日期:</div>
                <div class="info-value" th:text="${order.orderDate != null ? #dates.format(order.orderDate, 'yyyy-MM-dd HH:mm:ss') : '无日期'}"></div>
            </div>
        </div>

        <div class="card" th:if="${order.customer != null}">
            <h2>顾客信息</h2>
            <div class="info-row">
                <div class="info-label">顾客姓名:</div>
                <div class="info-value" th:text="${order.customer.name}"></div>
            </div>
            <div class="info-row">
                <div class="info-label">联系电话:</div>
                <div class="info-value" th:text="${order.customer.phone ?: '未填写'}"></div>
            </div>
            <div class="info-row">
                <div class="info-label">电子邮箱:</div>
                <div class="info-value" th:text="${order.customer.email ?: '未填写'}"></div>
            </div>
        </div>

        <div class="card" th:if="${order.orderDetails != null}">
            <h2>订单详情</h2>
            <div class="info-row">
                <div class="info-label">详情ID:</div>
                <div class="info-value" th:text="${order.orderDetails.id}"></div>
            </div>
            <div class="info-row">
                <div class="info-label">菜品ID:</div>
                <div class="info-value" th:text="${order.orderDetails.menuItemId}"></div>
            </div>
            <div class="info-row">
                <div class="info-label">数量:</div>
                <div class="info-value" th:text="${order.orderDetails.quantity}"></div>
            </div>
        </div>

        <div class="card" th:if="${order.orderDetails == null}">
            <div class="empty">该订单暂无详细信息</div>
        </div>

        <div style="text-align: center; margin-top: 30px;">
            <a th:href="@{/orders/list}" class="btn btn-secondary">🔙 返回列表</a>
        </div>
    </div>
</body>
</html>
